﻿using System;
using System.Windows.Forms;
using __ts.Core.Plugin;
using CCU.Controls;
using System.Collections.Specialized;
using __ts.Core.Configuration;

namespace CCU
{
    internal partial class ConfigsManageForm : Form
    {
        private static ConfigsManageForm current = new ConfigsManageForm();
        internal static ConfigsManageForm Current
        {
            get
            {
                return current;
            }
        }

        public ConfigsManageForm()
        {
            InitializeComponent();
        }

        private void ConfigsManage_Load(object sender, EventArgs e)
        {
            TabPage tabPage0 = new TabPage("Global");
            ConfigDataGridView configDataGridView0 = new ConfigDataGridView();
            configDataGridView0.Dock = DockStyle.Fill;
            configDataGridView0.Init();
            tabPage0.Controls.Add(configDataGridView0);
            this.tabControl1.TabPages.Add(tabPage0);

            foreach (int port in PluginManager.GetInstance.Ports)
            {
                TabPage tabPage = new TabPage("Port:"+port.ToString());
                ConfigDataGridView configDataGridView = new ConfigDataGridView();
                configDataGridView.Dock = DockStyle.Fill;
                configDataGridView.Init(port);
                tabPage.Controls.Add(configDataGridView);
                this.tabControl1.TabPages.Add(tabPage);
            }
        }

        private void EditConfigForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
            this.Visible = false;
        }
    }
}
